<?php
namespace app\baseinfo\validate;

class Company extends \app\common\validate\Base {
	protected $rule=[
		'name|企业名称'=>'length:1,50',
		'industry|所属行业'=>'length:1,50',
    'url|公司网址'=>'url',
    'logo|公司图标url'=>'url',
    'scode_length|防伪码长度' => 'gt:8',
    'scode_prefix|防伪码前缀' => 'length:3',
    'socde_character|防伪码组成字符' => 'length:16,100|character',
	];

	protected $create_require=['name'];

  protected function character($val) {
    if (strlen($val) == count(array_unique(str_split($val)))) {
      return true;
    } else {
      return "防伪码组成字符必须为唯一字符串";
    }
  }

}
?>